{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Learn Keras for Deep Neural Networks\n",
    "## Chapter 1 - An Introduction to Deep Learning and Keras\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A sneak peek in the Keras Framework"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/10\n",
      "1000/1000 [==============================] - 0s 358us/step - loss: 0.6941 - acc: 0.5100\n",
      "Epoch 2/10\n",
      "1000/1000 [==============================] - 0s 35us/step - loss: 0.6939 - acc: 0.5100\n",
      "Epoch 3/10\n",
      "1000/1000 [==============================] - 0s 37us/step - loss: 0.6938 - acc: 0.5100\n",
      "Epoch 4/10\n",
      "1000/1000 [==============================] - 0s 37us/step - loss: 0.6939 - acc: 0.5100\n",
      "Epoch 5/10\n",
      "1000/1000 [==============================] - 0s 36us/step - loss: 0.6938 - acc: 0.5100\n",
      "Epoch 6/10\n",
      "1000/1000 [==============================] - 0s 41us/step - loss: 0.6937 - acc: 0.5100\n",
      "Epoch 7/10\n",
      "1000/1000 [==============================] - 0s 40us/step - loss: 0.6937 - acc: 0.5100\n",
      "Epoch 8/10\n",
      "1000/1000 [==============================] - 0s 40us/step - loss: 0.6936 - acc: 0.5100\n",
      "Epoch 9/10\n",
      "1000/1000 [==============================] - 0s 40us/step - loss: 0.6936 - acc: 0.5100\n",
      "Epoch 10/10\n",
      "1000/1000 [==============================] - 0s 41us/step - loss: 0.6936 - acc: 0.5100\n"
     ]
    }
   ],
   "source": [
    "#Import required packages\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense\n",
    "import numpy as np\n",
    "\n",
    "# Getting the data ready\n",
    "# Generate train dummy data for 1000 Students and dummy test for 500\n",
    "#Columns :Age, Hours of Study & Avg Previous test scores\n",
    "np.random.seed(2018)\n",
    "train_data, test_data = np.random.random((1000, 3)), np.random.random((500, 3))\n",
    "#Generate dummy results for 1000 students : Whether Passed (1) or Failed (0)\n",
    "labels = np.random.randint(2, size=(1000, 1))\n",
    "\n",
    "#Defining the model structure with the required layers, # of neurons, activation function and optimizers\n",
    "model = Sequential()\n",
    "model.add(Dense(5, input_dim=3, activation='relu'))\n",
    "model.add(Dense(4, activation='relu'))\n",
    "model.add(Dense(1, activation='sigmoid'))\n",
    "model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])\n",
    "\n",
    "#Train the model and make predictions\n",
    "model.fit(train_data, labels, epochs=10, batch_size=32)\n",
    "\n",
    "#Make predictions from the trained model\n",
    "predictions = model.predict(test_data)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
